package com.nidu.demo.oauth2.dto;

import com.nidu.demo.base.BaseCmd;
import com.nidu.demo.common.enums.UserTypeEnum;
import com.nidu.demo.common.validation.InEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Data
@Schema(description = "OAuth2 AccessToken新增对象")
@EqualsAndHashCode(callSuper = true)
public class OAuth2AccessTokenAddCmd extends BaseCmd {

    /**
     * 用户ID
     */
    @NotNull(message = "用户ID不能为空")
    @Schema(description = "用户ID", example = "1")
    private Long userId;

    /**
     * 用户类型
     */
    @Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    @InEnum(UserTypeEnum.class)
    private Integer userType;

    /**
     * 用户信息
     */
    @Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private Map<String, String> userInfo;

    /**
     * 访问令牌
     */
    @NotNull(message = "访问令牌不能为空")
    @Schema(description = "访问令牌", example = "xxxx")
    private String accessToken;

    /**
     * 客户端编号
     */
    @NotNull(message = "客户端编号不能为空")
    @Schema(description = "客户端编号", example = "xxxx")
    private Long clientId;

    /**
     * 授权范围
     */
    @Schema(description = "授权范围", requiredMode = Schema.RequiredMode.REQUIRED, example = "xxx")
    private List<String> scopes;

    /**
     * 过期时间
     */
    @Schema(description = "过期时间", requiredMode = Schema.RequiredMode.REQUIRED)
    private LocalDateTime expiresTime;

}
